<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>mechanoChemIGA: Example 8 : Unconditionally stable scheme for gradient elasticity</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">mechanoChemIGA
   &#160;<span id="projectnumber">0.2.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="codestructure.html"><span>Code&#160;structure</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li><a href="modules.html"><span>Functions</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="https://github.com/mechanoChem/mechanoChem"><span>GitHub&#160;code&#160;repo</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Example 8 : Unconditionally stable scheme for gradient elasticity </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"> As in previous examples, we include the header file declaring the required user functions.</p>
<p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="user_functions_8h.html">userFunctions.h</a>&quot;</span></div>
</div><!-- fragment --></p>
<p>We define the initial conditions.</p>
<p><b> The <code>uinit</code> function </b></p>
<p>The initial conditions for the vector field are defined for this example problem as following.</p>
<p><div class="fragment"><div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vector_i, <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user){</div>
<div class="line">  <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> tmp; </div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;dim; i++) </div>
<div class="line">  {</div>
<div class="line">      tmp[i]=0;</div>
<div class="line">  }</div>
<div class="line">  <span class="keywordflow">if</span> ( (x[0]-0.5)*(x[0]-0.5)+(x[1]-0.5)*(x[1]-0.5)+(x[2]-0.5)*(x[2]-0.5) &lt; 0.1 ) tmp[0]=2.e-3;</div>
<div class="line">  <span class="keywordflow">return</span> tmp;</div>
<div class="line">}; <span class="comment">//end uinit</span></div>
</div><!-- fragment --></p>
<p><b> The <code>defineParameters</code> function </b></p>
<p>We are going to use periodic boundary conditions, which can be set as:</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#ac77e8a2af239ac3f36a49dfc69ad5c69">periodic</a>[0] = PETSC_TRUE;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ac77e8a2af239ac3f36a49dfc69ad5c69">periodic</a>[1] = PETSC_TRUE;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ac77e8a2af239ac3f36a49dfc69ad5c69">periodic</a>[2] = PETSC_TRUE;</div>
</div><!-- fragment --></p>
<p>Here, we define the mesh by setting the number of elements in each direction, e.g. a 4x4x4 element mesh.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[0] = 4;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[1] = 4;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[2] = 4;</div>
</div><!-- fragment --></p>
<p>We also define the dimensions of the domain, e.g. a unit cube.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[0] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[1] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[2] = 1.;</div>
</div><!-- fragment --></p>
<p>We specify the number of vector and scalar solution by adding the name of each field to their respective vector. Here, we only have one vector solution field (the displacement).</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#ae171e542b477f3394601555549b7d3a8">vectorSolnFields</a>.push_back(<span class="stringliteral">&quot;displacement&quot;</span>);</div>
</div><!-- fragment --></p>
<p>We also specify the polynomial order of the basis splines and the global continuity.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a23cded74ca3d8ec2f99d69e41d8539ca">polyOrder</a> = 2;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ae091f872a8ec5d2a5492586ae8fcbcbb">globalContinuity</a> = 1;</div>
</div><!-- fragment --></p>
<p>We redirect the desired user function pointer to the <code>uinit</code> functions that we defined above.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a2575f8ef3d910701696ec41b0b6b2aca">vectorInitialConditions</a> = <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>;</div>
</div><!-- fragment --></p>
<p>Finally, we define various (9) material parameters that describe our gradient elasticity.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>=(<span class="keywordtype">double</span> *) malloc(9*<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>));</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[0]=0.25;  <span class="comment">// r</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[1]=0.50;  <span class="comment">// curv</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[2]=500.;  <span class="comment">// e0</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[3]=250.;  <span class="comment">// e345</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[4]=0.025; <span class="comment">// le</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[5]=1.0;   <span class="comment">// rho</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[6]=1.0;   <span class="comment">// cii</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[7]=5.e-4; <span class="comment">// dt</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[8]=0.0;</div>
</div><!-- fragment --></p>
<p><b> The <code>residual</code> function </b></p>
<p>The residual function for an unconditionally stable second-order scheme for gradient-elasticity is used in this example.</p>
<p>We first declare <code>"eval_residual"</code> non-member function to be used in the member function, <code>"residual"</code>.</p>
<p><div class="fragment"><div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(T *residual, T *u, <span class="keywordtype">double</span> *up, <span class="keywordtype">double</span> *upp, <span class="keywordtype">double</span> *par);</div>
</div><!-- fragment --></p>
<p>The definition of the <code>eval_residual</code> function is postponed until the end of the file as it is lengthy.</p>
<p>For a complex problem like this example, where it is convenient to unfold "u.val", "u.grad", and "u.hess" and put them into a single array, ui[].</p>
<p><div class="fragment"><div class="line">  T ui[]={ u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[2], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][2][2] };</div>
</div><!-- fragment --></p>
<p>We do the same for previous solutions represented by ".valP", ".gradP", and ".hessP", and ".valPP", ".gradPP", and ".hessPP" as well as for the test functions "w1" and "w2" and produce arrays, up[], upp[], and w[], respectively.</p>
<p>We then evaluate the residual vector at a given quadrature point (residual[]) using the declared function "eval_residual".</p>
<p><div class="fragment"><div class="line">  T residual[ndof*nddim];</div>
<div class="line">  <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(residual,ui,up,upp,user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>);</div>
</div><!-- fragment --></p>
<p>Finally, we multiply residual[] by test functions and form the integrand of the weak form at the given quadrature point.</p>
<p><div class="fragment"><div class="line">  r=0;</div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;nddim*ndof; ++i) { r+=w[i]*residual[i]; }</div>
<div class="line">  r*=dV;</div>
</div><!-- fragment --></p>
<h1>A snippet of the code </h1>
 <div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="user_functions_8h.html">userFunctions.h</a>&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vector_i, <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user){</div>
<div class="line">  <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> tmp; </div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;dim; i++) </div>
<div class="line">  {</div>
<div class="line">      tmp[i]=0;</div>
<div class="line">  }</div>
<div class="line">  <span class="keywordflow">if</span> ( (x[0]-0.5)*(x[0]-0.5)+(x[1]-0.5)*(x[1]-0.5)+(x[2]-0.5)*(x[2]-0.5) &lt; 0.1 ) tmp[0]=2.e-3;</div>
<div class="line">  <span class="keywordflow">return</span> tmp;</div>
<div class="line">}; <span class="comment">//end uinit</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#ga31a2f2e526abaf0b8a00c2623e14f22e">projectFields</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x,</div>
<div class="line">           <span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;normal,</div>
<div class="line">           <span class="keyword">const</span> <a class="code" href="classsolution_scalars.html">solutionScalars&lt;dim,double&gt;</a> &amp;c,</div>
<div class="line">           <span class="keyword">const</span> <a class="code" href="classsolution_vectors.html">solutionVectors&lt;dim,double&gt;</a> &amp;u,</div>
<div class="line">           <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user,</div>
<div class="line">           std::vector&lt;double&gt; &amp;scalarProjections,</div>
<div class="line">           std::vector&lt;<a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &gt; &amp;vectorProjections){</div>
<div class="line">} <span class="comment">//end projectFields</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#gadbccf6631ad847d5a681a548f921ef29">defineParameters</a>(<a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a>&amp; user){</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ac77e8a2af239ac3f36a49dfc69ad5c69">periodic</a>[0] = PETSC_TRUE;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ac77e8a2af239ac3f36a49dfc69ad5c69">periodic</a>[1] = PETSC_TRUE;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ac77e8a2af239ac3f36a49dfc69ad5c69">periodic</a>[2] = PETSC_TRUE;</div>
<div class="line"> </div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[0] = 4;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[1] = 4;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[2] = 4;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[0] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[1] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[2] = 1.;</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ae171e542b477f3394601555549b7d3a8">vectorSolnFields</a>.push_back(<span class="stringliteral">&quot;displacement&quot;</span>);</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a9bc7b320034d23a4cb30b978ae0396c7">scalarProjectnFields</a>.push_back(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a23cded74ca3d8ec2f99d69e41d8539ca">polyOrder</a> = 2;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ae091f872a8ec5d2a5492586ae8fcbcbb">globalContinuity</a> = 1;</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a2575f8ef3d910701696ec41b0b6b2aca">vectorInitialConditions</a> = <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>;</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>=(<span class="keywordtype">double</span> *) malloc(9*<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>));</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[0]=0.25;  <span class="comment">// r</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[1]=0.50;  <span class="comment">// curv</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[2]=500.;  <span class="comment">// e0</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[3]=250.;  <span class="comment">// e345</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[4]=0.025; <span class="comment">// le</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[5]=1.0;   <span class="comment">// rho</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[6]=1.0;   <span class="comment">// cii</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[7]=5.e-4; <span class="comment">// dt</span></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[8]=0.0;</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a102ae36ef6e9df9f12c7e988659b5ff0">dt</a>    = user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[7];</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a4c155b92216444548c4457f18e050630">dtVal</a> = user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[7];</div>
<div class="line"></div>
<div class="line">} <span class="comment">//end defineParameters</span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(T *residual, T *u, <span class="keywordtype">double</span> *up, <span class="keywordtype">double</span> *upp, <span class="keywordtype">double</span> *par);</div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim, <span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#gab9195b3f02c923dafb2c742df293db7d">residual</a>(<span class="keywordtype">bool</span> dV,</div>
<div class="line">          <span class="keywordtype">bool</span> dS,</div>
<div class="line">              <span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x,</div>
<div class="line">          <span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;normal,</div>
<div class="line">          <span class="keyword">const</span> <a class="code" href="classsolution_scalars.html">solutionScalars&lt;dim,T&gt;</a> &amp;c,</div>
<div class="line">          <span class="keyword">const</span> <a class="code" href="classsolution_vectors.html">solutionVectors&lt;dim,T&gt;</a> &amp;u,</div>
<div class="line">          <span class="keyword">const</span> <a class="code" href="classtest_function_scalars.html">testFunctionScalars&lt;dim,T&gt;</a> &amp;w1,</div>
<div class="line">          <span class="keyword">const</span> <a class="code" href="classtest_function_vectors.html">testFunctionVectors&lt;dim,T&gt;</a> &amp;w2,</div>
<div class="line">          <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user,</div>
<div class="line">          Sacado::Fad::SimpleFad&lt;T&gt; &amp;r){</div>
<div class="line">  <span class="keywordtype">int</span> ndim=dim;</div>
<div class="line">  <span class="keywordtype">int</span> ndof=3;</div>
<div class="line">  <span class="keywordtype">int</span> nddim=1+ndim+ndim*(ndim+1)/2;</div>
<div class="line">  T ui[]={ u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[2], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][2][2] };</div>
<div class="line">  <span class="keywordtype">double</span> </div>
<div class="line">    up[]={ u.<a class="code" href="classsolution_vectors.html#a1836cd014f8661d1227c06a11d0c062e">valP</a>(0)[0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[0][0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[0][1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][0][0], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][0][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][1][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a1836cd014f8661d1227c06a11d0c062e">valP</a>(0)[1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[1][0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[1][1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][0][0], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][0][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][1][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a1836cd014f8661d1227c06a11d0c062e">valP</a>(0)[2], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[2][0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[2][1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[2][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][0][0], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][0][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][1][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][2][2] };</div>
<div class="line">  <span class="keywordtype">double</span> </div>
<div class="line">   upp[]={ u.<a class="code" href="classsolution_vectors.html#a06555b85e034541704dfeaa49bda557d">valPP</a>(0)[0], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[0][0], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[0][1], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[0][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[0][0][0], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[0][0][1], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[0][0][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[0][1][1], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[0][1][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[0][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a06555b85e034541704dfeaa49bda557d">valPP</a>(0)[1], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[1][0], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[1][1], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[1][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[1][0][0], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[1][0][1], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[1][0][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[1][1][1], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[1][1][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[1][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a06555b85e034541704dfeaa49bda557d">valPP</a>(0)[2], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[2][0], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[2][1], u.<a class="code" href="classsolution_vectors.html#a96aa41f289ed0543479d9adea2d5d5a1">gradPP</a>(0)[2][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[2][0][0], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[2][0][1], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[2][0][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[2][1][1], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[2][1][2], u.<a class="code" href="classsolution_vectors.html#add858ceba263f785b66c4156017789ec">hessPP</a>(0)[2][2][2] };</div>
<div class="line">  Sacado::Fad::SimpleFad&lt;T&gt; </div>
<div class="line">    w[]= { w2.<a class="code" href="classtest_function_vectors.html#a2c3f7998bd59d6cc139d4e23dc711079">val</a>(0)[0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[0][0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[0][1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][0][0], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][0][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][1][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][2][2],</div>
<div class="line">           w2.<a class="code" href="classtest_function_vectors.html#a2c3f7998bd59d6cc139d4e23dc711079">val</a>(0)[1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[1][0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[1][1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][0][0], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][0][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][1][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][2][2],</div>
<div class="line">           w2.<a class="code" href="classtest_function_vectors.html#a2c3f7998bd59d6cc139d4e23dc711079">val</a>(0)[2], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[2][0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[2][1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[2][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][0][0], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][0][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][1][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][2][2] };</div>
<div class="line">  T residual[ndof*nddim];</div>
<div class="line">  <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(residual,ui,up,upp,user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>);</div>
<div class="line">  r=0;</div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;nddim*ndof; ++i) { r+=w[i]*residual[i]; }</div>
<div class="line">  r*=dV;</div>
<div class="line">  <span class="comment">//r += -(w2.val(0)*h)*dS; //Traction</span></div>
<div class="line"></div>
<div class="line">} <span class="comment">//end residual</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(T *residual_, T *u, <span class="keywordtype">double</span> *u1, <span class="keywordtype">double</span> *u0, <span class="keywordtype">double</span> *par)</div>
<div class="line">{</div>
<div class="line"><span class="keywordtype">double</span> comp[4116];</div>
<div class="line">*(comp+0)=(-1 + pow(1 + ((*(u0+1)) + (*(u1+1)))/2.,2) + pow((*(u0+11)) + (*(u1+11)),2)/4. + pow((*(u0+21)) + (*(u1+21)),2)/4.)/2.;</div>
<div class="line">*(comp+1)=(((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+2)) + (*(u1+2))))/2. + (((*(u0+11)) + (*(u1+11)))*(1 + ((*(u0+12)) + (*(u1+12)))/2.))/2. + (((*(u0+21)) + (*(u1+21)))*((*(u0+22)) + (*(u1+22))))/4.)/2.;</div>
<div class="line">*(comp+2)=(((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+3)) + (*(u1+3))))/2. + (((*(u0+11)) + (*(u1+11)))*((*(u0+13)) + (*(u1+13))))/4. + (((*(u0+21)) + (*(u1+21)))*(1 + ((*(u0+23)) + (*(u1+23)))/2.))/2.)/2.;</div>
<div class="line">*(comp+3)=(-1 + pow((*(u0+2)) + (*(u1+2)),2)/4. + pow(1 + ((*(u0+12)) + (*(u1+12)))/2.,2) + pow((*(u0+22)) + (*(u1+22)),2)/4.)/2.;</div>
<div class="line">*(comp+4)=((((*(u0+2)) + (*(u1+2)))*((*(u0+3)) + (*(u1+3))))/4. + ((1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+13)) + (*(u1+13))))/2. + (((*(u0+22)) + (*(u1+22)))*(1 + ((*(u0+23)) + (*(u1+23)))/2.))/2.)/2.;</div>
<div class="line">*(comp+5)=(-1 + pow((*(u0+3)) + (*(u1+3)),2)/4. + pow((*(u0+13)) + (*(u1+13)),2)/4. + pow(1 + ((*(u0+23)) + (*(u1+23)))/2.,2))/2.;</div>
<div class="line">*(comp+6)=((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+4)) + (*(u1+4))) + (((*(u0+11)) + (*(u1+11)))*((*(u0+14)) + (*(u1+14))))/2. + (((*(u0+21)) + (*(u1+21)))*((*(u0+24)) + (*(u1+24))))/2.)/2.;</div>
<div class="line">*(comp+7)=((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+5)) + (*(u1+5))) + (((*(u0+11)) + (*(u1+11)))*((*(u0+15)) + (*(u1+15))))/2. + (((*(u0+21)) + (*(u1+21)))*((*(u0+25)) + (*(u1+25))))/2.)/2.;</div>
<div class="line">*(comp+8)=((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+6)) + (*(u1+6))) + (((*(u0+11)) + (*(u1+11)))*((*(u0+16)) + (*(u1+16))))/2. + (((*(u0+21)) + (*(u1+21)))*((*(u0+26)) + (*(u1+26))))/2.)/2.;</div>
<div class="line">*(comp+9)=((((*(u0+2)) + (*(u1+2)))*((*(u0+4)) + (*(u1+4))))/4. + ((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+5)) + (*(u1+5))))/2. + ((1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+14)) + (*(u1+14))))/2. + (((*(u0+11)) + (*(u1+11)))*((*(u0+15)) + (*(u1+15))))/4. + (((*(u0+22)) + (*(u1+22)))*((*(u0+24)) + (*(u1+24))))/4. + (((*(u0+21)) + (*(u1+21)))*((*(u0+25)) + (*(u1+25))))/4.)/2.;</div>
<div class="line">*(comp+10)=((((*(u0+2)) + (*(u1+2)))*((*(u0+5)) + (*(u1+5))))/4. + ((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+7)) + (*(u1+7))))/2. + ((1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+15)) + (*(u1+15))))/2. + (((*(u0+11)) + (*(u1+11)))*((*(u0+17)) + (*(u1+17))))/4. + (((*(u0+22)) + (*(u1+22)))*((*(u0+25)) + (*(u1+25))))/4. + (((*(u0+21)) + (*(u1+21)))*((*(u0+27)) + (*(u1+27))))/4.)/2.;</div>
<div class="line">*(comp+11)=((((*(u0+2)) + (*(u1+2)))*((*(u0+6)) + (*(u1+6))))/4. + ((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+8)) + (*(u1+8))))/2. + ((1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+16)) + (*(u1+16))))/2. + (((*(u0+11)) + (*(u1+11)))*((*(u0+18)) + (*(u1+18))))/4. + (((*(u0+22)) + (*(u1+22)))*((*(u0+26)) + (*(u1+26))))/4. + (((*(u0+21)) + (*(u1+21)))*((*(u0+28)) + (*(u1+28))))/4.)/2.;</div>
<div class="line">*(comp+12)=((((*(u0+3)) + (*(u1+3)))*((*(u0+4)) + (*(u1+4))))/4. + ((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+6)) + (*(u1+6))))/2. + (((*(u0+13)) + (*(u1+13)))*((*(u0+14)) + (*(u1+14))))/4. + (((*(u0+11)) + (*(u1+11)))*((*(u0+16)) + (*(u1+16))))/4. + ((1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+24)) + (*(u1+24))))/2. + (((*(u0+21)) + (*(u1+21)))*((*(u0+26)) + (*(u1+26))))/4.)/2.;</div>
<div class="line">*(comp+13)=((((*(u0+3)) + (*(u1+3)))*((*(u0+5)) + (*(u1+5))))/4. + ((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+8)) + (*(u1+8))))/2. + (((*(u0+13)) + (*(u1+13)))*((*(u0+15)) + (*(u1+15))))/4. + (((*(u0+11)) + (*(u1+11)))*((*(u0+18)) + (*(u1+18))))/4. + ((1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+25)) + (*(u1+25))))/2. + (((*(u0+21)) + (*(u1+21)))*((*(u0+28)) + (*(u1+28))))/4.)/2.;</div>
<div class="line">*(comp+14)=((((*(u0+3)) + (*(u1+3)))*((*(u0+6)) + (*(u1+6))))/4. + ((1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+9)) + (*(u1+9))))/2. + (((*(u0+13)) + (*(u1+13)))*((*(u0+16)) + (*(u1+16))))/4. + (((*(u0+11)) + (*(u1+11)))*((*(u0+19)) + (*(u1+19))))/4. + ((1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+26)) + (*(u1+26))))/2. + (((*(u0+21)) + (*(u1+21)))*((*(u0+29)) + (*(u1+29))))/4.)/2.;</div>
<div class="line">*(comp+15)=((((*(u0+2)) + (*(u1+2)))*((*(u0+5)) + (*(u1+5))))/2. + (1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+15)) + (*(u1+15))) + (((*(u0+22)) + (*(u1+22)))*((*(u0+25)) + (*(u1+25))))/2.)/2.;</div>
<div class="line">*(comp+16)=((((*(u0+2)) + (*(u1+2)))*((*(u0+7)) + (*(u1+7))))/2. + (1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+17)) + (*(u1+17))) + (((*(u0+22)) + (*(u1+22)))*((*(u0+27)) + (*(u1+27))))/2.)/2.;</div>
<div class="line">*(comp+17)=((((*(u0+2)) + (*(u1+2)))*((*(u0+8)) + (*(u1+8))))/2. + (1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+18)) + (*(u1+18))) + (((*(u0+22)) + (*(u1+22)))*((*(u0+28)) + (*(u1+28))))/2.)/2.;</div>
<div class="line">*(comp+18)=((((*(u0+3)) + (*(u1+3)))*((*(u0+5)) + (*(u1+5))))/4. + (((*(u0+2)) + (*(u1+2)))*((*(u0+6)) + (*(u1+6))))/4. + (((*(u0+13)) + (*(u1+13)))*((*(u0+15)) + (*(u1+15))))/4. + ((1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+16)) + (*(u1+16))))/2. + ((1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+25)) + (*(u1+25))))/2. + (((*(u0+22)) + (*(u1+22)))*((*(u0+26)) + (*(u1+26))))/4.)/2.;</div>
<div class="line">*(comp+19)=((((*(u0+3)) + (*(u1+3)))*((*(u0+7)) + (*(u1+7))))/4. + (((*(u0+2)) + (*(u1+2)))*((*(u0+8)) + (*(u1+8))))/4. + (((*(u0+13)) + (*(u1+13)))*((*(u0+17)) + (*(u1+17))))/4. + ((1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+18)) + (*(u1+18))))/2. + ((1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+27)) + (*(u1+27))))/2. + (((*(u0+22)) + (*(u1+22)))*((*(u0+28)) + (*(u1+28))))/4.)/2.;</div>
<div class="line">*(comp+20)=((((*(u0+3)) + (*(u1+3)))*((*(u0+8)) + (*(u1+8))))/4. + (((*(u0+2)) + (*(u1+2)))*((*(u0+9)) + (*(u1+9))))/4. + (((*(u0+13)) + (*(u1+13)))*((*(u0+18)) + (*(u1+18))))/4. + ((1 + ((*(u0+12)) + (*(u1+12)))/2.)*((*(u0+19)) + (*(u1+19))))/2. + ((1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+28)) + (*(u1+28))))/2. + (((*(u0+22)) + (*(u1+22)))*((*(u0+29)) + (*(u1+29))))/4.)/2.;</div>
<div class="line">*(comp+21)=((((*(u0+3)) + (*(u1+3)))*((*(u0+6)) + (*(u1+6))))/2. + (((*(u0+13)) + (*(u1+13)))*((*(u0+16)) + (*(u1+16))))/2. + (1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+26)) + (*(u1+26))))/2.;</div>
<div class="line">*(comp+22)=((((*(u0+3)) + (*(u1+3)))*((*(u0+8)) + (*(u1+8))))/2. + (((*(u0+13)) + (*(u1+13)))*((*(u0+18)) + (*(u1+18))))/2. + (1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+28)) + (*(u1+28))))/2.;</div>
<div class="line">*(comp+23)=((((*(u0+3)) + (*(u1+3)))*((*(u0+9)) + (*(u1+9))))/2. + (((*(u0+13)) + (*(u1+13)))*((*(u0+19)) + (*(u1+19))))/2. + (1 + ((*(u0+23)) + (*(u1+23)))/2.)*((*(u0+29)) + (*(u1+29))))/2.;</div>
<div class="line">*(comp+24)=((*(comp+0)) + (*(comp+3)) + (*(comp+5)))/sqrt(3);</div>
<div class="line">*(comp+25)=((*(comp+0)) - (*(comp+3)))/sqrt(2);</div>
<div class="line">*(comp+26)=((*(comp+0)) + (*(comp+3)) - 2*(*(comp+5)))/sqrt(6);</div>
<div class="line">*(comp+27)=((*(comp+6)) + (*(comp+15)) + (*(comp+21)))/sqrt(3);</div>
<div class="line">*(comp+28)=((*(comp+7)) + (*(comp+16)) + (*(comp+22)))/sqrt(3);</div>
<div class="line">*(comp+29)=((*(comp+8)) + (*(comp+17)) + (*(comp+23)))/sqrt(3);</div>
<div class="line">*(comp+30)=((*(comp+6)) - (*(comp+15)))/sqrt(2);</div>
<div class="line">*(comp+31)=((*(comp+7)) - (*(comp+16)))/sqrt(2);</div>
<div class="line">*(comp+32)=((*(comp+8)) - (*(comp+17)))/sqrt(2);</div>
<div class="line">*(comp+33)=((*(comp+6)) + (*(comp+15)) - 2*(*(comp+21)))/sqrt(6);</div>
<div class="line">*(comp+34)=((*(comp+7)) + (*(comp+16)) - 2*(*(comp+22)))/sqrt(6);</div>
<div class="line">*(comp+35)=((*(comp+8)) + (*(comp+17)) - 2*(*(comp+23)))/sqrt(6);</div>
<div class="line">*(comp+36)=-((1.3333333333333333*(*(par+0)) - 1.3333333333333333*(*(par+0))*(*(par+1)))/(pow((*(par+0)),2)*(pow((*(par+0)),2) - 2*pow((*(par+0)),2)*(*(par+1)) - (*(par+0))*(1.3333333333333333*(*(par+0)) - 1.3333333333333333*(*(par+0))*(*(par+1))))));</div>
<div class="line">*(comp+37)=(2*(*(par+1)))/(pow((*(par+0)),2) - 2*pow((*(par+0)),2)*(*(par+1)) - (*(par+0))*(1.3333333333333333*(*(par+0)) - 1.3333333333333333*(*(par+0))*(*(par+1))));</div>
<div class="line">*(comp+38)=-(1/(pow((*(par+0)),2)*(pow((*(par+0)),2) - 2*pow((*(par+0)),2)*(*(par+1)) - (*(par+0))*(1.3333333333333333*(*(par+0)) - 1.3333333333333333*(*(par+0))*(*(par+1))))));</div>
<div class="line">*(comp+39)=sqrt(2)*(*(comp+30))*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.) + sqrt(0.6666666666666666)*(*(comp+33))*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.);</div>
<div class="line">*(comp+40)=sqrt(2)*(*(comp+31))*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.) + sqrt(0.6666666666666666)*(*(comp+34))*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.) - ((*(comp+30))*pow((*(par+4)),2)*((*(u0+2)) + (*(u1+2))))/sqrt(2) + ((*(comp+33))*pow((*(par+4)),2)*((*(u0+2)) + (*(u1+2))))/sqrt(6);</div>
<div class="line">*(comp+41)=sqrt(2)*(*(comp+32))*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.) + sqrt(0.6666666666666666)*(*(comp+35))*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.) - sqrt(0.6666666666666666)*(*(comp+33))*pow((*(par+4)),2)*((*(u0+3)) + (*(u1+3)));</div>
<div class="line">*(comp+42)=-(((*(comp+31))*pow((*(par+4)),2)*((*(u0+2)) + (*(u1+2))))/sqrt(2)) + ((*(comp+34))*pow((*(par+4)),2)*((*(u0+2)) + (*(u1+2))))/sqrt(6);</div>
<div class="line">*(comp+43)=-(((*(comp+32))*pow((*(par+4)),2)*((*(u0+2)) + (*(u1+2))))/sqrt(2)) + ((*(comp+35))*pow((*(par+4)),2)*((*(u0+2)) + (*(u1+2))))/sqrt(6) - sqrt(0.6666666666666666)*(*(comp+34))*pow((*(par+4)),2)*((*(u0+3)) + (*(u1+3)));</div>
<div class="line">*(comp+44)=-(sqrt(0.6666666666666666)*(*(comp+35))*pow((*(par+4)),2)*((*(u0+3)) + (*(u1+3))));</div>
<div class="line">*(comp+45)=((*(comp+30))*pow((*(par+4)),2)*((*(u0+11)) + (*(u1+11))))/sqrt(2) + ((*(comp+33))*pow((*(par+4)),2)*((*(u0+11)) + (*(u1+11))))/sqrt(6);</div>
<div class="line">*(comp+46)=((*(comp+31))*pow((*(par+4)),2)*((*(u0+11)) + (*(u1+11))))/sqrt(2) + ((*(comp+34))*pow((*(par+4)),2)*((*(u0+11)) + (*(u1+11))))/sqrt(6) - sqrt(2)*(*(comp+30))*pow((*(par+4)),2)*(1 + ((*(u0+12)) + (*(u1+12)))/2.) + sqrt(0.6666666666666666)*(*(comp+33))*pow((*(par+4)),2)*(1 + ((*(u0+12)) + (*(u1+12)))/2.);</div>
<div class="line">*(comp+47)=((*(comp+32))*pow((*(par+4)),2)*((*(u0+11)) + (*(u1+11))))/sqrt(2) + ((*(comp+35))*pow((*(par+4)),2)*((*(u0+11)) + (*(u1+11))))/sqrt(6) - sqrt(0.6666666666666666)*(*(comp+33))*pow((*(par+4)),2)*((*(u0+13)) + (*(u1+13)));</div>
<div class="line">*(comp+48)=-(sqrt(2)*(*(comp+31))*pow((*(par+4)),2)*(1 + ((*(u0+12)) + (*(u1+12)))/2.)) + sqrt(0.6666666666666666)*(*(comp+34))*pow((*(par+4)),2)*(1 + ((*(u0+12)) + (*(u1+12)))/2.);</div>
<div class="line">*(comp+49)=-(sqrt(2)*(*(comp+32))*pow((*(par+4)),2)*(1 + ((*(u0+12)) + (*(u1+12)))/2.)) + sqrt(0.6666666666666666)*(*(comp+35))*pow((*(par+4)),2)*(1 + ((*(u0+12)) + (*(u1+12)))/2.) - sqrt(0.6666666666666666)*(*(comp+34))*pow((*(par+4)),2)*((*(u0+13)) + (*(u1+13)));</div>
<div class="line">*(comp+50)=-(sqrt(0.6666666666666666)*(*(comp+35))*pow((*(par+4)),2)*((*(u0+13)) + (*(u1+13))));</div>
<div class="line">*(comp+51)=((*(comp+30))*pow((*(par+4)),2)*((*(u0+21)) + (*(u1+21))))/sqrt(2) + ((*(comp+33))*pow((*(par+4)),2)*((*(u0+21)) + (*(u1+21))))/sqrt(6);</div>
<div class="line">*(comp+52)=((*(comp+31))*pow((*(par+4)),2)*((*(u0+21)) + (*(u1+21))))/sqrt(2) + ((*(comp+34))*pow((*(par+4)),2)*((*(u0+21)) + (*(u1+21))))/sqrt(6) - ((*(comp+30))*pow((*(par+4)),2)*((*(u0+22)) + (*(u1+22))))/sqrt(2) + ((*(comp+33))*pow((*(par+4)),2)*((*(u0+22)) + (*(u1+22))))/sqrt(6);</div>
<div class="line">*(comp+53)=((*(comp+32))*pow((*(par+4)),2)*((*(u0+21)) + (*(u1+21))))/sqrt(2) + ((*(comp+35))*pow((*(par+4)),2)*((*(u0+21)) + (*(u1+21))))/sqrt(6) - 2*sqrt(0.6666666666666666)*(*(comp+33))*pow((*(par+4)),2)*(1 + ((*(u0+23)) + (*(u1+23)))/2.);</div>
<div class="line">*(comp+54)=-(((*(comp+31))*pow((*(par+4)),2)*((*(u0+22)) + (*(u1+22))))/sqrt(2)) + ((*(comp+34))*pow((*(par+4)),2)*((*(u0+22)) + (*(u1+22))))/sqrt(6);</div>
<div class="line">*(comp+55)=-(((*(comp+32))*pow((*(par+4)),2)*((*(u0+22)) + (*(u1+22))))/sqrt(2)) + ((*(comp+35))*pow((*(par+4)),2)*((*(u0+22)) + (*(u1+22))))/sqrt(6) - 2*sqrt(0.6666666666666666)*(*(comp+34))*pow((*(par+4)),2)*(1 + ((*(u0+23)) + (*(u1+23)))/2.);</div>
<div class="line">*(comp+56)=-2*sqrt(0.6666666666666666)*(*(comp+35))*pow((*(par+4)),2)*(1 + ((*(u0+23)) + (*(u1+23)))/2.);</div>
<div class="line">*(comp+57)=(4*pow((*(par+4)),2)*pow(1 + ((*(u0+1)) + (*(u1+1)))/2.,2))/3.;</div>
<div class="line">*(comp+58)=-(pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+2)) + (*(u1+2))))/3.;</div>
<div class="line">*(comp+59)=-(pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+3)) + (*(u1+3))))/3.;</div>
<div class="line">*(comp+60)=(2*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+11)) + (*(u1+11))))/3.;</div>
<div class="line">*(comp+61)=(-2*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.)*(1 + ((*(u0+12)) + (*(u1+12)))/2.))/3.;</div>
<div class="line">*(comp+62)=-(pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+13)) + (*(u1+13))))/3.;</div>
<div class="line">*(comp+63)=(2*pow((*(par+4)),2)*(1 + ((*(u0+1)) + (*(u1+1)))/2.)*((*(u0+21)) + (*(u1+21))))/3.;</div>
</div><!-- fragment --> </p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
